Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HW-Isolation: Fix Additional Data Uri #1128

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

deepakala-k
Copy link
Contributor

The guard records could be associated with hidden or visible PEL. The additional URI for visible pel would be
/redfish/v1/Systems/system/LogServices/EventLog/Entries//attachment and for the hidden ones it has be
/redfish/v1/Systems/system/LogServices/CELog/Entries//attachment

So before adding the AdditionalDataURI, check for the hidden property of the PEL and add the URI accordingly.

Tested and found it works as expected

{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries",
  "@odata.type": "#LogEntryCollection.LogEntryCollection",
  "Description": "Collection of System Hardware Isolation Entries",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries/1",
      "@odata.type": "#LogEntry.v1_9_0.LogEntry",
      "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/CELog/Entries/824/attachment",
      "Created": "2025-01-23T12:57:02+00:00",
      "EntryType": "Event",
      "Id": "1",
      "Links": {
        "OriginOfCondition": {
          "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors/core0"
        }
      },
      "Message": "Spare Guard Record core0",
      "MessageArgs": [
        "Spare",
        "core0"
      ],
      "MessageId": "OpenBMC.0.6.GuardRecord",
      "Name": "Hardware Isolation Entry",
      "Severity": "OK"
    },
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries/3",
      "@odata.type": "#LogEntry.v1_9_0.LogEntry",
      "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/830/attachment",
      "Created": "2025-01-23T13:08:31+00:00",
      "EntryType": "Event",
      "Id": "3",
      "Links": {
        "OriginOfCondition": {
          "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu1/SubProcessors/core0"
        }
      },
      "Message": "Spare Guard Record core0",
      "MessageArgs": [
        "Spare",
        "core0"
      ],
      "MessageId": "OpenBMC.0.6.GuardRecord",
      "Name": "Hardware Isolation Entry",
      "Severity": "OK"
    },
}

The guard records could be associated with hidden or visible PEL. The
additional URI for visible pel would be
/redfish/v1/Systems/system/LogServices/EventLog/Entries/<id>/attachment
and for the hidden ones it has be
/redfish/v1/Systems/system/LogServices/CELog/Entries/<id>/attachment

So before adding the AdditionalDataURI, check for the hidden property of
the PEL and add the URI accordingly.

Tested and found it works as expected

```
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries",
  "@odata.type": "#LogEntryCollection.LogEntryCollection",
  "Description": "Collection of System Hardware Isolation Entries",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries/1",
      "@odata.type": "#LogEntry.v1_9_0.LogEntry",
      "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/CELog/Entries/824/attachment",
      "Created": "2025-01-23T12:57:02+00:00",
      "EntryType": "Event",
      "Id": "1",
      "Links": {
        "OriginOfCondition": {
          "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors/core0"
        }
      },
      "Message": "Spare Guard Record core0",
      "MessageArgs": [
        "Spare",
        "core0"
      ],
      "MessageId": "OpenBMC.0.6.GuardRecord",
      "Name": "Hardware Isolation Entry",
      "Severity": "OK"
    },
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries/3",
      "@odata.type": "#LogEntry.v1_9_0.LogEntry",
      "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/830/attachment",
      "Created": "2025-01-23T13:08:31+00:00",
      "EntryType": "Event",
      "Id": "3",
      "Links": {
        "OriginOfCondition": {
          "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu1/SubProcessors/core0"
        }
      },
      "Message": "Spare Guard Record core0",
      "MessageArgs": [
        "Spare",
        "core0"
      ],
      "MessageId": "OpenBMC.0.6.GuardRecord",
      "Name": "Hardware Isolation Entry",
      "Severity": "OK"
    },
}
```
? asyncResp->res
.jsonValue["Members"]
[entryJsonIdx - 1]
: asyncResp->res.jsonValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this already defined above L7125?

    nlohmann::json& entryJson =
        (entryJsonIdx > 0
             ? asyncResp->res.jsonValue["Members"][entryJsonIdx - 1]
             : asyncResp->res.jsonValue);

If so, can L7243 be written as

                                entryJson["AdditionalDataURI"] =
                                    boost::urls::format(
                                        "/redfish/v1/Systems/system/LogServices/{}/Entries/{}/attachment",
                                        logPath, entryID);

Copy link
Contributor Author

@deepakala-k deepakala-k Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is within the asyn dbus callback. So by the time, the dbus call is successful with the hidden property value, it could have moved out the function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is within the asyn dbus callback. So by the time, the dbus call is successful with the hidden property value, it could have moved out the function

You're right. entryJson needs to be reset.
BTW, would this async callback be better to be a separate function?

@deepakala-k deepakala-k requested a review from baemyung January 25, 2025 14:12
Copy link
Contributor

@devenrao devenrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@baemyung baemyung requested review from gtmills and jeaaustx January 27, 2025 13:53
Copy link
Contributor

@baemyung baemyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides a minor comment, it looks good to me

? asyncResp->res
.jsonValue["Members"]
[entryJsonIdx - 1]
: asyncResp->res.jsonValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is within the asyn dbus callback. So by the time, the dbus call is successful with the hidden property value, it could have moved out the function

You're right. entryJson needs to be reset.
BTW, would this async callback be better to be a separate function?

@rfrandse rfrandse merged commit 50c9dc3 into ibm-openbmc:1110 Jan 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants